﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EPiServer.Core;
using TemplateFoundation.Core;
using TemplateFoundation.PageTypes;

namespace TemplateFoundation.UserControls
{
    /// <summary>
    /// Base class for user controls
    /// </summary>
    public abstract class UserControlBase : PageTypeBuilder.UI.UserControlBase<PageTypeBase>
    {
        /// <summary>
        /// Gets the current root page, the first page beneath the start page in the current page's path
        /// </summary>
        /// <remarks>If currently on the start page, or on a page outside the site structure, the start page is returned</remarks>
        public virtual PageTypeBase CurrentRootPage
        {
            get
            {
                return CurrentPage.GetRootPage();
            }
        }
    }

    /// <summary>
    /// Base class for user controls
    /// </summary>
    public abstract class UserControlBase<T> : PageTypeBuilder.UI.UserControlBase<T> where T : PageTypeBase
    {
        /// <summary>
        /// Gets the current root page, the first page beneath the start page in the current page's path
        /// </summary>
        /// <remarks>If currently on the start page, or on a page outside the site structure, the start page is returned</remarks>
        public virtual PageTypeBase CurrentRootPage
        {
            get
            {
                return CurrentPage.GetRootPage();
            }
        }
    }
}
